home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 March / CMCD0304.ISO / Software / Freeware / Programare / nullsoft / nsis20.exe / Examples / Modern UI / InstallOptions.nsi < prev    next >
Text File  |  2004-02-06  |  4KB  |  148 lines

  1. ;NSIS Modern User Interface version 1.70
  2. ;InstallOptions Example Script
  3. ;Written by Joost Verburg
  4.  
  5. ;---------------------
  6. ;Include Modern UI
  7.  
  8.   !include "MUI.nsh"
  9.  
  10. ;--------------------------------
  11. ;General
  12.  
  13.   ;Name and file
  14.   Name "Modern UI Test 1.70"
  15.   OutFile "InstallOptions.exe"
  16.  
  17.   ;Default installation folder
  18.   InstallDir "$PROGRAMFILES\Modern UI Test"
  19.   
  20.   ;Get installation folder from registry if available
  21.   InstallDirRegKey HKCU "Software\Modern UI Test" ""
  22.  
  23. ;--------------------------------
  24. ;Pages
  25.  
  26.   !insertmacro MUI_PAGE_LICENSE "${NSISDIR}\Contrib\Modern UI\License.txt"
  27.   Page custom CustomPageA
  28.   !insertmacro MUI_PAGE_COMPONENTS
  29.   Page custom CustomPageB
  30.   !insertmacro MUI_PAGE_DIRECTORY
  31.   Page custom CustomPageC
  32.   !insertmacro MUI_PAGE_INSTFILES
  33.   
  34.   !insertmacro MUI_UNPAGE_CONFIRM
  35.   !insertmacro MUI_UNPAGE_INSTFILES
  36.   
  37. ;--------------------------------
  38. ;Interface Settings
  39.  
  40.   !define MUI_ABORTWARNING
  41.   
  42. ;--------------------------------
  43. ;Languages
  44.  
  45.   !insertmacro MUI_LANGUAGE "English"
  46.  
  47. ;--------------------------------
  48. ;Reserve Files
  49.   
  50.   ;These files should be inserted before other files in the data block
  51.   ;Keep these lines before any File command
  52.   ;Only for solid compression (by default, solid compression is enabled for BZIP2 and LZMA)
  53.   
  54.   ReserveFile "ioA.ini"
  55.   ReserveFile "ioB.ini"
  56.   ReserveFile "ioC.ini"
  57.   !insertmacro MUI_RESERVEFILE_INSTALLOPTIONS
  58.  
  59. ;--------------------------------
  60. ;Variables
  61.  
  62.   Var INI_VALUE
  63.  
  64. ;--------------------------------
  65. ;Installer Sections
  66.  
  67. Section "Dummy Section" SecDummy
  68.  
  69.   SetOutPath "$INSTDIR"
  70.   
  71.   ;ADD YOUR OWN FILES HERE...
  72.   
  73.   ;Store installation folder
  74.   WriteRegStr HKCU "Software\Modern UI Test" "" $INSTDIR
  75.   
  76.   ;Create uninstaller
  77.   WriteUninstaller "$INSTDIR\Uninstall.exe"
  78.   
  79.   ;Read a value from an InstallOptions INI file
  80.   !insertmacro MUI_INSTALLOPTIONS_READ $INI_VALUE "ioC.ini" "Field 2" "State"
  81.   
  82.   ;Display a messagebox if check box was checked
  83.   StrCmp $INI_VALUE "1" "" +2
  84.     MessageBox MB_OK "You checked the check box, here is the MessageBox..."
  85.  
  86. SectionEnd
  87.  
  88. ;--------------------------------
  89. ;Installer Functions
  90.  
  91. Function .onInit
  92.  
  93.   ;Extract InstallOptions INI files
  94.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioA.ini"
  95.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioB.ini"
  96.   !insertmacro MUI_INSTALLOPTIONS_EXTRACT "ioC.ini"
  97.   
  98. FunctionEnd
  99.  
  100. LangString TEXT_IO_TITLE ${LANG_ENGLISH} "InstallOptions page"
  101. LangString TEXT_IO_SUBTITLE ${LANG_ENGLISH} "This is a page created using the InstallOptions plug-in."
  102.  
  103. Function CustomPageA
  104.  
  105.   !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
  106.   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioA.ini"
  107.  
  108. FunctionEnd
  109.  
  110. Function CustomPageB
  111.  
  112.   !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
  113.   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioB.ini"
  114.  
  115. FunctionEnd
  116.  
  117. Function CustomPageC
  118.  
  119.   !insertmacro MUI_HEADER_TEXT "$(TEXT_IO_TITLE)" "$(TEXT_IO_SUBTITLE)"
  120.   !insertmacro MUI_INSTALLOPTIONS_DISPLAY "ioC.ini"
  121.  
  122. FunctionEnd
  123.  
  124. ;--------------------------------
  125. ;Descriptions
  126.  
  127.   ;Language strings
  128.   LangString DESC_SecDummy ${LANG_ENGLISH} "A test section."
  129.  
  130.   ;Assign language strings to sections
  131.   !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN
  132.     !insertmacro MUI_DESCRIPTION_TEXT ${SecDummy} $(DESC_SecDummy)
  133.   !insertmacro MUI_FUNCTION_DESCRIPTION_END
  134.  
  135. ;--------------------------------
  136. ;Uninstaller Section
  137.  
  138. Section "Uninstall"
  139.  
  140.   ;ADD YOUR OWN FILES HERE...
  141.  
  142.   Delete "$INSTDIR\Uninstall.exe"
  143.  
  144.   RMDir "$INSTDIR"
  145.  
  146.   DeleteRegKey /ifempty HKCU "Software\Modern UI Test"
  147.  
  148. SectionEnd